<?php 
$j = 0;
if($adc->CurrentAd->getFromCountry())
{
	if($adc->CurrentAd->getFromCountry() != $adc->CurrentAd->getToCountry())
	{ $label = ucfirst($txt->getWord('from').' '.$txt->getWord('country')); }
	else
	{ $label = ucfirst($txt->getWord('city')); }
	
	$rows[0][$j]['label'] = $label;
	$rows[0][$j]['value'] = $adc->getCountryTitle($adc->CurrentAd->getFromCountry());
	$j++;
}

if(($adc->CurrentAd->getToCountry() != '') && ($adc->CurrentAd->getFromCountry() != $adc->CurrentAd->getToCountry()))
{
	$rows[0][$j]['label'] = ucfirst($txt->getWord('to').' '.$txt->getWord('country'));
	$rows[0][$j]['value'] = $adc->getCountryTitle($adc->CurrentAd->getToCountry());
	$j++;
}

if($adc->CurrentAd->getFromCity())
{
	if($adc->CurrentAd->getFromCity() != $adc->CurrentAd->getToCity())
	{ $label = ucfirst($txt->getWord('from').' '.$txt->getWord('city')); }
	else
	{ $label = ucfirst($txt->getWord('city')); }
	
	$rows[0][$j]['label'] = $label;
	$rows[0][$j]['value'] = ucfirst($adc->CurrentAd->getFromCity());
	$j++;
}

if(($adc->CurrentAd->getToCity() != '') && ($adc->CurrentAd->getFromCity() != $adc->CurrentAd->getToCity()))
{
	$rows[0][$j]['label'] = ucfirst($txt->getWord('to').' '.$txt->getWord('city'));
	$rows[0][$j]['value'] = ucfirst($adc->CurrentAd->getToCity());
	$j++;
}

if($adc->CurrentAd->getFromZip())
{
	$rows[0][$j]['label'] = ucfirst($txt->getWord('from').' '.$txt->getWord('zip'));
	$rows[0][$j]['value'] = $adc->CurrentAd->getFromZip();
	$j++;
}

if($adc->CurrentAd->getToZip())
{
	$rows[0][$j]['label'] = ucfirst($txt->getWord('to').' '.$txt->getWord('zip'));
	$rows[0][$j]['value'] = $adc->CurrentAd->getToZip();
	$j++;
}
if(($adc->CurrentAd->getFromDate() != '') && ($adc->CurrentAd->getFromDate('Y-m-d') != '1970-01-01'))
{
	$rows[0][$j]['label'] = ucfirst($txt->getWord('from').' '.$txt->getWord('date'));
	$rows[0][$j]['value'] = $adc->CurrentAd->getFromDate('d.m.Y');
	$j++;
}

if(($adc->CurrentAd->getToDate() != '') && ($adc->CurrentAd->getToDate('Y-m-d') != '1970-01-01'))
{
	$rows[0][$j]['label'] = ucfirst($txt->getWord('to').' '.$txt->getWord('date'));
	$rows[0][$j]['value'] = $adc->CurrentAd->getToDate('d.m.Y');
	$j++;
}

$rows[0][$j]['label'] = '&nbsp;';
$rows[0][$j]['value'] = '';
$j++;

// LEFT SIDE COMPLETE
$j = 0;

if($adc->CurrentAd->getLengthUsed() > 0)
{
	if($adc->CurrentAd->getIsBuying() == 0)
	{ $rows[1][$j]['label'] = ucfirst($txt->getWord('max')).' '; }
	$rows[1][$j]['label'] .= ucfirst($txt->getWord('distance'));
	$rows[1][$j]['value'] = $adc->CurrentAd->getLengthUsed();
	if($adc->CurrentAd->getTypeId() != 3)
	{ $rows[1][$j]['unit'] = '&nbsp;km'; }
	$j++;
}
if($adc->CurrentAd->getWeight() > 0)
{
	if($adc->CurrentAd->getIsBuying() == 0)
	{ $rows[1][$j]['label'] = ucfirst($txt->getWord('max')).' '; }
	$rows[1][$j]['label'] .= ucfirst($txt->getWord('payload'));
	$rows[1][$j]['value'] = $adc->CurrentAd->getWeight();
	$rows[1][$j]['unit'] = 'kg';
	$j++;
}
if($adc->CurrentAd->getLength() > 0)
{
	if($adc->CurrentAd->getIsBuying() == 0)
	{ $rows[1][$j]['label'] = ucfirst($txt->getWord('max')).' '; }
	$rows[1][$j]['label'] .= ucfirst($txt->getWord('length'));
	$rows[1][$j]['value'] = $adc->CurrentAd->getLength();
	$rows[1][$j]['unit'] = 'cm';
	$j++;
}
if($adc->CurrentAd->getWidth() > 0)
{
	if($adc->CurrentAd->getIsBuying() == 0)
	{ $rows[1][$j]['label'] = ucfirst($txt->getWord('max')).' '; }
	$rows[1][$j]['label'] .= ucfirst($txt->getWord('width'));
	$rows[1][$j]['value'] = $adc->CurrentAd->getWidth();
	$rows[1][$j]['unit'] = 'cm';
	$j++;
}

$rows[1][$j]['label'] = '&nbsp;';
$rows[1][$j]['value'] = '';
$j++;

//$j = 0;
if($adc->CurrentAd->getStandingOrder() > 0)
{
	if($adc->CurrentAd->getIsBuying() > 0)
	{ $rows[1][$j]['label'] = ucfirst($txt->getWord('standing_order')); }
	else
	{ $rows[1][$j]['label'] = ucfirst($txt->getWord('standing_offer')); }
	
	$rows[1][$j]['value'] = $okIcon;
	$j++;
}




unset($j);
if($rows > 0)
{
	foreach(array_keys($rows) as $i)
	{
		if(count($rows[$i]) > 0)
		{
			$rows[$i]['table'] = '<table border="0" cellpadding="0" cellspacing="0">';
			foreach(array_keys($rows[$i]) as $j)
			{
				if(is_array($rows[$i][$j]))
				{
					if(is_int($rows[$i][$j]['value']))
					{ $rows[$i][$j]['value'] = number_format($rows[$i][$j]['value'], 0, ',', ' '); }
					
					$rows[$i]['table'] .= 	'<tr>';
					$rows[$i]['table'] .= 		'<td class="left '.$adc->getSetting('AttributeClass').'">'.$rows[$i][$j]['label'].'</td>';
					if($rows[$i][$j]['value'])
					{
						$rows[$i]['table'] .= 		'<td>&nbsp;:&nbsp;&nbsp;</td>';
						$rows[$i]['table'] .= 		'<td class="left '.$adc->getSetting('AttributeValClass').'">'.$rows[$i][$j]['value'].' '.$rows[$i][$j]['unit'].'</td>';
					}
					$rows[$i]['table'] .= 	'</tr>';
				}
			}
			$rows[$i]['table'] .= '</table>';
		}
	}
}
?>
<div class="row-fluid">
	<div class="w60 overflow_hidden"><h3><?php echo $adc->getCurrentAd()->getTitle(); ?></h3></div>
    <div class="w40 top right medium">
    	<?php 
		if(($adc->CurrentAd->getDisplayPrice() > 0) && ($adc->CurrentAd->getPriceGlobal() > 0))
		{ 
			echo '<h3 itemprop="price">';
			require($adc->getViewPath().'elements/Price.php');
			echo '</h3>';
			echo '<h4 class="price-financed"></h4>';
		}
		?>
        <?php if($adc->getCurrentAd()->getIsCompleted() > 0): ?>
        	<div class="sold float-right">
			<p class="float-left"><?php echo ucfirst($adc->getCurrentAd()->getIsBoughtText()); ?>&nbsp;&nbsp;</p>
			<img src="<?php echo SYSICONS_URL ?>ok_24.png" width="24" height="24" alt="<?php echo ucfirst($adc->getCurrentAd()->getIsBoughtText()); ?>" title="<?php echo ucfirst($txt->getWord('sold')); ?>">
			</div>
        <?php endif; ?>
    </div>
</div>
<h3><?php echo ucfirst($txt->getWord('information')); ?></h3>
<div class="row-fluid">
	<div class="span6 col-md-6 w2"><?php  echo $rows[0]['table']; ?></div>
    <div class="span6 col-md-6 w2"><?php  echo $rows[1]['table']; ?></div>
</div><br /><hr />